Tiny Script Works In Interactive Mode But Not Batch Mode

I wrote this sample script which works fine using DOORS in interactive mode.

When the script is launched in batch mode the command window returns the message:

"
DXL contains 2 errors
Press return to exit DOORS.
"

Does anyone see what is incorrect?

The way the DXL file is launched in batch mode is

"C:\Program Files\DOORS\9.2\doors.exe" -u Administrator -P theCheese -b "D:\dxl\tinyScript.dxl"
 

// Open module
 Module m = read("/Foo/testModule",false,true)
 if (!null m) { hideExplorer(m) }
 
 // Count objects
 int i = 0
 Object o 
 for o in m do { i++ }
 
 // Write count to file
 Stream outFile = write "D:\\theFile.log"
 outFile << i""
 
 // Close handles
 close(outFile)
 close(m)

pete.kowalski - Wed Jan 13 10:07:14 EST 2010

Re: Tiny Script Works In Interactive Mode But Not Batch Mode
Peter_Albert - Wed Jan 13 10:34:52 EST 2010

Hmm, the script runs for me without error.

Are you sure you don't get an error message indicating the code line where the error occurs?

Peter

Re: Tiny Script Works In Interactive Mode But Not Batch Mode
pete.kowalski - Wed Jan 13 11:00:21 EST 2010

Peter_Albert - Wed Jan 13 10:34:52 EST 2010
Hmm, the script runs for me without error.

Are you sure you don't get an error message indicating the code line where the error occurs?

Peter

Peter:

My DOORS 9.2 client is configured to write any DXL errors to an external file on the disk. This particular file is empty.

Re: Tiny Script Works In Interactive Mode But Not Batch Mode
pete.kowalski - Wed Jan 13 11:20:17 EST 2010

pete.kowalski - Wed Jan 13 11:00:21 EST 2010
Peter:

My DOORS 9.2 client is configured to write any DXL errors to an external file on the disk. This particular file is empty.

After trying some more things, I noticed if I put "noError" as the first line my batch script runs and produces the log file at the end with the correct object count.

I am still haunting down the DXL errors.

Re: Tiny Script Works In Interactive Mode But Not Batch Mode
llandale - Wed Jan 13 14:01:28 EST 2010

Your code runs for me in batch mode, but of course gets a run time error at the null module loop. When I introduce an error, I get different output.
-E- DXL: <Line:17> incorrectly concatenated tokens
-E- DXL: <Line:17> undeclared variable (s)
-I- DXL: all done with 2 errors and 0 warnings

I'm guessing you have some stranger DXL invoked in your Batch startup file, and the error you are getting is from that, not your script.

Try it with a simple DXL, perhaps
print "Hello simple\n"

  • Louie

Write better code, such as halting when m is null.

Re: Tiny Script Works In Interactive Mode But Not Batch Mode
llandale - Wed Jan 13 14:08:38 EST 2010

pete.kowalski - Wed Jan 13 11:20:17 EST 2010
After trying some more things, I noticed if I put "noError" as the first line my batch script runs and produces the log file at the end with the correct object count.

I am still haunting down the DXL errors.

At the bottom, then, put this:
print "Errors: \n"

Re: Tiny Script Works In Interactive Mode But Not Batch Mode
llandale - Wed Jan 13 14:10:22 EST 2010

llandale - Wed Jan 13 14:08:38 EST 2010
At the bottom, then, put this:
print "Errors: \n"

Didn't come out right.

print "Errors: =" lastError() "=\n"

Re: Tiny Script Works In Interactive Mode But Not Batch Mode
pete.kowalski - Thu Jan 14 13:06:05 EST 2010

llandale - Wed Jan 13 14:01:28 EST 2010
Your code runs for me in batch mode, but of course gets a run time error at the null module loop. When I introduce an error, I get different output.
-E- DXL: <Line:17> incorrectly concatenated tokens
-E- DXL: <Line:17> undeclared variable (s)
-I- DXL: all done with 2 errors and 0 warnings

I'm guessing you have some stranger DXL invoked in your Batch startup file, and the error you are getting is from that, not your script.

Try it with a simple DXL, perhaps
print "Hello simple\n"

  • Louie

Write better code, such as halting when m is null.

Thanks for your tips, llandale.

I will try them out and report back.